#include <head.h>

void * func_pthread(void *arg)
{
    printf("hello\n");
    
    // int val =10;
    // void *exit_val = &val;

    // static int val =10;
    // void * exit_val = &val;
    
    int *val = malloc(4);
    *val = 10;
    void * exit_val = val;

    pthread_exit(exit_val);
}


int main(int argc, char const *argv[])
{
    pthread_t tid;

    pthread_create(&tid ,NULL ,func_pthread ,NULL);

    int val = 10;
    void * exit_val;
    pthread_join(tid ,&exit_val);
    
    val = *((int *)exit_val);
    printf("val = %d\n",val);

    return 0;
}